home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus Leser 15 / Amiga Plus Leser CD 15.iso / Tools / Development / CIT.v4 / Demo / ClickTabDemo.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-13  |  5.2 KB  |  170 lines

  1. #include <CITGroup.h>
  2. #include <CITButton.h>
  3. #include <CITClickTab.h>
  4. #include <CITString.h>
  5. #include <CITListBrowser.h>
  6.  
  7. CITApp Application;
  8.  
  9. CITWorkbench   myScreen;
  10. CITWindow      myWindow;
  11. CITVGroup      winGroup;
  12. CITVGroup      page[2];
  13. CITHGroup      nameGroup,cityGroup,phoneGroup;
  14. CITHGroup      browserGroup,buttonGroup;
  15. CITVGroup      ordersDetailGroup;
  16. CITClickTab    clickTab;
  17. CITString      company,last,first;
  18. CITString      address1,address2;
  19. CITString      city,state,zip;
  20. CITString      phone,fax;
  21. CITListBrowser customers,orders,details;
  22. CITButton      newOrder,editOrder,deleteOrder;
  23. CITButton      quitButton;
  24.  
  25. void CloseEvent();
  26. void QuitEvent(ULONG ID);
  27.  
  28. int main()
  29. {
  30.   BOOL Error=FALSE;
  31.  
  32.   myScreen.InsObject(myWindow,Error);
  33.     myWindow.Position(WPOS_CENTERSCREEN);
  34.     myWindow.Activate();
  35.     myWindow.CloseGadget();
  36.     myWindow.DragBar();
  37.     myWindow.SizeGadget();
  38.     myWindow.DepthGadget();
  39.     myWindow.IconifyGadget();
  40.     myWindow.Caption("CITClickTab demo");
  41.     myWindow.CloseEventHandler(CloseEvent);
  42.     myWindow.InsObject(winGroup,Error);
  43.       winGroup.InsObject(clickTab,Error);
  44.       winGroup.SpaceOuter();
  45.       winGroup.SpaceInner();
  46.         clickTab.NewTab(page[0],"_Contacts");
  47.           page[0].SpaceOuter();
  48.           page[0].SpaceInner();
  49.           page[0].BevelStyle(BVS_NONE);
  50.           page[0].InsObject(company,Error);
  51.             company.LabelText("Company:");
  52.             company.TextVal("");
  53.             company.MaxChars(48);
  54.             company.TabCycle();
  55.             company.MinWidth(200);
  56.           page[0].InsObject(nameGroup,Error);
  57.             nameGroup.WeightedHeight(0);
  58.             nameGroup.InsObject(last,Error);
  59.               last.LabelText("Last");
  60.               last.TextVal("");
  61.               last.MaxChars(48);
  62.               last.TabCycle();
  63.             nameGroup.InsObject(first,Error);
  64.               first.LabelText("First");
  65.               first.TextVal("");
  66.               first.MaxChars(48);
  67.               first.TabCycle();
  68.           page[0].InsObject(address1,Error);
  69.             address1.LabelText("Address 1");
  70.             address1.TextVal("");
  71.             address1.MaxChars(48);
  72.             address1.TabCycle();
  73.           page[0].InsObject(address2,Error);
  74.             address2.LabelText("Address 1");
  75.             address2.TextVal("");
  76.             address2.MaxChars(48);
  77.             address2.TabCycle();
  78.           page[0].InsObject(cityGroup,Error);
  79.             cityGroup.WeightedHeight(0);
  80.             cityGroup.InsObject(city,Error);
  81.               city.LabelText("City");
  82.               city.TextVal("");
  83.               city.MaxChars(48);
  84.               city.TabCycle();
  85.             cityGroup.InsObject(state,Error);
  86.               state.LabelText("State");
  87.               state.TextVal("");
  88.               state.MaxChars(48);
  89.               state.TabCycle();
  90.             cityGroup.InsObject(zip,Error);
  91.               zip.LabelText("ZipCode");
  92.               zip.TextVal("");
  93.               zip.MaxChars(24);
  94.               zip.TabCycle();
  95.           page[0].InsObject(phoneGroup,Error);
  96.             phoneGroup.WeightedHeight(0);
  97.             phoneGroup.BevelStyle(BVS_SBAR_VERT);
  98.             phoneGroup.TopSpacing(2);
  99.             phoneGroup.InsObject(phone,Error);
  100.               phone.LabelText("phone");
  101.               phone.TextVal("");
  102.               phone.MaxChars(48);
  103.               phone.TabCycle();
  104.             nameGroup.InsObject(fax,Error);
  105.               fax.LabelText("Fax");
  106.               fax.TextVal("");
  107.               fax.MaxChars(48);
  108.               fax.TabCycle();
  109.         clickTab.NewTab(page[1],"_Orders");
  110.           page[1].SpaceOuter();
  111.           page[1].SpaceInner();
  112.           page[1].BevelStyle(BVS_NONE);
  113.           page[1].InsObject(browserGroup,Error);
  114.             browserGroup.SpaceInner();
  115.             browserGroup.InsObject(customers,Error);
  116.               customers.ShowSelected();
  117.               customers.HorizontalProp();
  118.               customers.WeightedWidth(30);
  119.             browserGroup.InsObject(ordersDetailGroup,Error);
  120.               ordersDetailGroup.SpaceInner();
  121.               ordersDetailGroup.WeightedWidth(70);
  122.               ordersDetailGroup.InsObject(orders,Error);
  123.                 orders.ShowSelected();
  124.                 orders.HorizontalProp();
  125.               ordersDetailGroup.InsObject(details,Error);
  126.                 details.ShowSelected();
  127.                 details.HorizontalProp();
  128.           page[1].InsObject(buttonGroup,Error);
  129.             buttonGroup.WeightedHeight(0);
  130.             buttonGroup.InsObject(newOrder,Error);
  131.               newOrder.Text("_New Order");
  132.             buttonGroup.InsObject(editOrder,Error);
  133.               editOrder.Text("_Edit Order");
  134.             buttonGroup.InsObject(deleteOrder,Error);
  135.               deleteOrder.Text("_Delete Order");
  136.       winGroup.InsObject(quitButton,Error);
  137.         quitButton.Text("Quit");
  138.         quitButton.WeightedHeight(0);
  139.         quitButton.EventHandler(QuitEvent);
  140.  
  141.   //
  142.   // Allign labels
  143.   //
  144.   myWindow.Align(page[0],nameGroup);
  145.   myWindow.Align(nameGroup,cityGroup);
  146.   myWindow.Align(cityGroup,phoneGroup);
  147.  
  148.   Application.InsObject(myScreen,Error);
  149.  
  150.   // Ok?
  151.   if( Error )
  152.     return 10;
  153.  
  154.   Application.Run();
  155.  
  156.   Application.RemObject(myScreen);
  157.  
  158.   return 0;
  159. }
  160.  
  161. void QuitEvent(ULONG ID)
  162. {
  163.   Application.Stop();
  164. }
  165.  
  166. void CloseEvent()
  167. {
  168.   Application.Stop();
  169. }
  170.